package com.guo.rpc.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @Author: ljguo4
 * @email: ljguo4@iflytek.com
 * @Date: 2021/7/26 19:48
 * @Description:
 * @version: 1.0
 */
public class RefrenceBean<T> implements FactoryBean, ApplicationContextAware {

    private Class<?> interfaceClass;

    private String version;

    private ApplicationContext applicationContext;

    @Override
    public Object getObject() {

        // 1. 返回一个代理对象
        // 2. 代理对象可以远程调用接口服务



        return null;
    }

    @Override
    public Class<?> getObjectType() {
        return RefrenceBean.class;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public Class<?> getInterfaceClass() {
        return interfaceClass;
    }

    public void setInterfaceClass(Class<?> interfaceClass) {
        this.interfaceClass = interfaceClass;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }
}
